package com.zjxf.controller;


import com.sun.istack.internal.NotNull;
import com.zjxf.base.bean.po.CmsSchoolCourse;
import com.zjxf.base.common.JSONResponse;
import com.zjxf.controller.common.BaseController;
import com.zjxf.service.CmsSchoolCourseService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;
import java.util.List;

/**
 * 课程管理Controller
 * Created by lzz on 2021/4/1.
 */
@Api(tags = "CourseController", description = "课程管理")
@AllArgsConstructor
@RestController
@RequestMapping("/app/course/")
public class CourseController extends BaseController {

    private final CmsSchoolCourseService cmsSchoolCourseService;

    /**
     * 查询所有课程
     *
     * @return JSONResponse
     */
    @ApiOperation("查询所有课程")
    @PostMapping(value = "findCollection")
    public JSONResponse selectCollections(){
        List<CmsSchoolCourse> page = cmsSchoolCourseService.page();
        return success(page);
    }

    /**
     * 查询指定课程的详细信息
     *
     * @param id 课程编号
     * @return JSONResponse
     */
    @ApiOperation("查询指定课程的详细信息")
    @PostMapping(value = "find/{id}")
    public JSONResponse deleteCollection(@NotNull @PathVariable Long id){
        CmsSchoolCourse course = cmsSchoolCourseService.get(id);
        return success(course);
    }
}
